package xm.erzhan.conf.ResourcesConf;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Mine {
    private static Mine mineIns;

    public class MineItem {
        public int lv;
        public int costFood;
        public int costSteel;
        public int costOil;
        public int costSlime;
        public int product;
        public int costSec;

        public MineItem(int lv, int costFood, int costSteel, int costOil, int costSlime, int product, int costSec) {
            this.lv = lv;
            this.costFood = costFood;
            this.costSteel = costSteel;
            this.costOil = costOil;
            this.costSlime = costSlime;
            this.product = product;
            this.costSec = costSec;
        }

    }

    public List<Mine.MineItem> mineItems = new ArrayList<Mine.MineItem>();

    public Mine.MineItem getConfByLv(int lv) {

        Mine.MineItem mineItem = null;

        Iterator<Mine.MineItem> iterator = this.mineItems.iterator();

        Mine.MineItem item;
        while (iterator.hasNext()) {
            item = iterator.next();
            if (item.lv == lv) {
                mineItem = item;
                break;
            }
        }

        return mineItem;
    }

    public void initMineItems() {

        this.mineItems.add(new Mine.MineItem(1, 300, 200, 150, 250, 500, 50000));
        this.mineItems.add(new Mine.MineItem(2, 500, 700, 450, 750, 1000, 15));
        this.mineItems.add(new Mine.MineItem(3, 1300, 1500, 1450, 1550, 4500, 30));
        this.mineItems.add(new Mine.MineItem(4, 2500, 2700, 1650, 2750, 5000, 100));
        this.mineItems.add(new Mine.MineItem(5, 3500, 5700, 2600, 7750, 8000, 150));
        this.mineItems.add(new Mine.MineItem(6, 13500, 15700, 12650, 17750, 13500, 260));
        this.mineItems.add(new Mine.MineItem(7, 22100, 22200, 21150, 22250, 25000, 340));
        this.mineItems.add(new Mine.MineItem(8, 40100, 40200, 40150, 40250, 40500, 480));
        this.mineItems.add(new Mine.MineItem(9, 60100, 60200, 60150, 60250, 60500, 560));
    }

    public static Mine shared() {
        if (mineIns == null) {
            mineIns = new Mine();
            mineIns.initMineItems();
        }

        return mineIns;
    }
}
